package top.ysh.mapper;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import top.ysh.pojo.User;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {

    // 查询所有
    @Select("select * from t_user")
    public List<User> findAll();

    // 新增用户
    @Insert("insert into t_user(userName,password,realName,gender,birthday)values(#{userName},#{password},#{realName},#{gender},#{birthday})")
    public boolean save(User user);

    // 修改用户信息
    @Update("update t_user " +
            "        set userName=#{userName},password=#{password},realName=#{realName},gender=#{gender},birthday=#{birthday} " +
            "        where uuid=#{uuid}")
    public boolean update(User user);

    // 删除用户信息
    @Delete("delete from t_user where uuid=#{uuid}")
    public boolean delete(Integer uuid);

}
